<!DOCTYPE html>

<html>
<title>NewsBlur - Connecting...</title>

<head>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    
    <style>
        body {
            font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            font-size: 16px;
            font-weight: bold;
            color: #A0A0A0;
            font-style: italic;
        }
        .NB-loader {
            margin: 72px auto;
            width: 256px;
            height: 256px;
            display: block;
            -webkit-animation: -webkit-slow-spin 3.4s infinite linear;    
            -moz-animation-duration: 6.8s;  
            -moz-animation-name: -moz-slow-spin;  
            -moz-animation-iteration-count: infinite;  
            -moz-animation-timing-function: linear;  
        }
        @media screen and (max-width: 320px) {
            .NB-loader {
                margin: 42px auto;
                width: 200px;
                height: 200px;
            }
        }
        
        @-webkit-keyframes -webkit-slow-spin {
            from {-webkit-transform: rotate(0deg)}
            to  {-webkit-transform: rotate(360deg)}
        }
        @-moz-keyframes -moz-slow-spin {  
            from {-moz-transform: rotate(0deg)}
            to  {-moz-transform: rotate(360deg)}
        } 
    </style>
    <script type="text/javascript" charset="utf-8">
        window.NEWSBLUR = window.NEWSBLUR || {};

        if (!window.console) {
            window.console = {};
            window.console.log = function() {};
        }
        var opener = parent && parent.window.opener || window.opener;
        var next = "{{ next|safe }}";
        if (next) {
            console.log(["Forwarding to next", next, opener]);
            setTimeout(function() {
                console.log(["Forwarding to next", next, opener]);
                window.location.href = next;
            }, 1000);
        } else if (opener && opener.NEWSBLUR) {
            console.log(["Found opener", opener.NEWSBLUR]);
            if (opener.NEWSBLUR.intro) {
                console.log(['Connecting through intro']);
                opener.NEWSBLUR.intro.post_connect({
                    {% if error %}
                        'error': "{{ error }}"
                    {% endif %}
                });
            } else if (opener.NEWSBLUR.reader_friends) {
                console.log(["Connecting through friends dialog"]);
                opener.NEWSBLUR.reader_friends.post_connect({
                    {% if error %}
                        'error': "{{ error }}"
                    {% endif %}
                });
            }
            window.close();
        } else {
            console.log(["No opener, directing to /", opener]);
            NEWSBLUR.error = "{{ error }}";
            window.close();
            window.location.href = "/";
        }
    </script>
</head>

<body>

    <div style="text-align: center;">

        <img class="NB-loader" src="{{ MEDIA_URL }}img/logo_512.png">

        <div>Hold on just a smidgen...</div>
        <div>If I was a bird I'd be a pigeon.</div>

    </div>

</body>
</html>
